﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MongoData
{
    using MongoDB.Bson.Serialization.Attributes;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace Model.MongoDb
    {
        public class Goods
        {
            public Goods()
            {
                this.Price = -1;
                this.ExamplePrice = "";
            }

            //主表是GoodsShop

            /// <summary>
            /// 门店商品id(GoodsShopID)
            /// </summary>
            public string _id { get; set; }
            public long GoodsBasicID { get; set; }
            public long GoodsAgentID { get; set; }
            public int ShopInfoID { get; set; }
            public decimal CostPrice { get; set; }
            public decimal Price { get; set; }
            public string SetShowTime { get; set; }
            /// <summary>
            /// 位置状态：1：推荐（置顶），2：还原位置，3：置底
            /// </summary>
            public int LocationStatus { get; set; }
            /// <summary>
            /// 现货、期货状态；(0现货)
            /// </summary>
            public int ISExist { get; set; }
            public long Sorting { get; set; }
            /// <summary>
            /// 0 上架 1 仓库中 2 未处理
            /// </summary>
            public int IsSale { get; set; }
            /// <summary> 
            /// 是否可还价(0:可还价)
            /// </summary>
            public int IsBargain { get; set; }
            /// <summary>
            /// 是否联盟显示(0显示)
            /// </summary>
            public int IsShow { get; set; }
            /// <summary>
            /// 状态：0正常，1已删除，2已屏蔽
            /// </summary>
            public int Status { get; set; }
            /// <summary>
            /// 销量数
            /// </summary>
            public long SaleNum { get; set; }
            /// <summary>
            /// 评价数
            /// </summary>
            public long CommentNum { get; set; }
            /// <summary>
            /// 老客户回访总数
            /// </summary>
            public long RVNum { get; set; }
            /// <summary>
            /// 门店类型id
            /// </summary>
            //  public int ShopType { get; set; }
            #region 活动部分
            //新品(1:是)
            private int _isNew = 0;
            public int IsNew { get { return _isNew; } set { _isNew = value; } }
            //促销(1:是)
            private int _isCu = 0;
            public int IsCu { get { return _isCu; } set { _isCu = value; } }
            //赠品(1:是)
            private int _isZeng = 0;
            public int IsZeng { get { return _isZeng; } set { _isZeng = value; } }

            #endregion


            #region 企业部分信息

            public int GoodsClassID { get; set; }
            public int BrandID { get; set; }
            public string GModel { get; set; }
            public string BarCode { get; set; }
            public string EnterpriseID { get; set; }
            public DateTime AddTime { get; set; }
            public decimal EPrice { get; set; }
            /// <summary>
            /// 商品主图（推送）
            /// </summary>
            public string GoodsIMG { get; set; }
            /// <summary>
            /// 商品快照商品id
            /// </summary>
            public long GESnapshotID { get; set; }
            /// <summary>
            /// 快照商品名称
            /// </summary>
            public string GName { get; set; }
            /// <summary>
            /// 快照商品图片
            /// </summary>
            public string Img { get; set; }
            /// <summary>
            /// 企业描述
            /// </summary>
            public string EContent { set; get; }

            #endregion

            #region 代理商信息
            /// <summary>
            /// 代理商商品快照id
            /// </summary>
            public long GCSnapshotID { get; set; }
            /// <summary>
            /// 代理商id
            /// </summary>
            public long AgentID { get; set; }
            /// <summary>
            /// 代理商描述商品明细
            /// </summary>
            public string AContent { get; set; }
            #endregion

            #region 门店商品快照信息
            /// <summary>
            /// 门店商品快照id(GSSnapshot)
            /// </summary>
            public long GSSnapshotID { get; set; }
            /// <summary>
            /// 门店商品明细
            /// </summary>
            public string SContent { get; set; }

            #endregion

            public List<Attributes> attrList { get; set; }

            /// <summary>
            /// 这个值可以用来保存浏览记录的id 收藏记录的id
            /// 这样可以用主键来删除记录了 提高效率
            /// </summary>
            [BsonIgnore]
            public string PVInfoID { get; set; }

            private int _ShowType_ = 0;
            /// <summary>
            /// 用来标记是否已经赋值过
            /// </summary>
            [BsonIgnore]
            public int ShowType_
            {
                set { this._ShowType_ = value; }
                get
                {
                    //var cc = TypeDescriptor.GetAttributes(this);
                    //if (cc != null)
                    //{
                    //    OtherAttribute attr = ((OtherAttribute)cc[typeof(OtherAttribute)]);
                    //    if (attr != null) { _ShowType_ = attr.id; }
                    //}
                    return this._ShowType_;
                }
            }

            /// <summary>
            /// 实例价格
            /// </summary>
            public string ExamplePrice { get; set; }

            /// <summary>
            /// 浏览次数
            /// </summary>
            public long BrowseCount { get; set; }

        }
        public class Attributes
        {
            /// <summary>
            /// 属性值ID
            /// </summary>
            public long _id { get; set; }
            /// <summary>
            /// 属性值名称
            /// </summary>
            public string VName { get; set; }
            /// <summary>
            /// 属性名ID
            /// </summary>
            public long AttributesID { get; set; }
            /// <summary>
            /// 属性名名称
            /// </summary>
            public string AName { get; set; }

            public long GoodsBasicID { get; set; }
        }

    }

}
